package com.xc.stock.infrastructure.job;

import java.util.concurrent.TimeUnit;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.ag.utils.MdcUtil;
import com.google.common.base.Stopwatch;
import com.xc.stock.domain.basic.service.AccountService;
import com.xc.stock.utils.Utils;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Component
public class JobBoot {
    @Scheduled(cron="0 0/10 * * * ? ")
	public void doLimitWithrawPassJob() {
    	if(! Utils.enableScheduled()) {
    		return;
    	}
    	
		MdcUtil.setTraceIdIfAbsent();
		Stopwatch stopwatch = Stopwatch.createStarted();
		long count = AccountService.of().doLimitWithrawPassJob();
		log.info("doLimitWithrawPassJob执行, 受影响数{}, 耗时:{}毫秒", count, stopwatch.elapsed(TimeUnit.MILLISECONDS));
	}
}
